package cn.cnf.service;


import cn.cnf.common.enums.RecommendState;
import cn.cnf.common.enums.StateEnum;
import cn.cnf.common.enums.VerifyState;
import cn.cnf.entity.Novel;
import cn.cnf.entity.NovelDetails;
import cn.cnf.entity.vo.NovelDetailsInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;
import java.util.List;

/**
 * 服务接口
 *
 * @author ZhuMeiYi
 * @description
 * @since 2020-12-04 15:18:43
 */
public interface NovelService extends IService<Novel> {

    String addOrUpdate(Novel novel);

    boolean isAuthor(String novelId,String userId);

    String addOrNovelDetails(NovelDetails novelDetails);

    IPage<Novel> selectPage(Integer current, Integer pageSize,String name);

    NovelDetailsInfo getChapterDetails(String novelId, String chapterId);

    /**
     * 调整作品收入
     *
     * @param novelId
     * @param num
     * @return
     */
    BigDecimal adjustNovelMoneyById(String novelId, BigDecimal num);

    String recommend(String novelId, RecommendState state);

    IPage<Novel> getVerifying(Integer current, Integer pageSize);

    String novelVerify(String novelId, VerifyState state);

    Integer updateSubscribe(String subscribeId, int number);

    List<Novel> getRecentlyUpdate(Integer current, Integer pageSize);

    IPage<Novel> getAllRecommend(Integer current, Integer pageSize);

    IPage<Novel> rank(Integer current, Integer pageSize, SFunction<Novel,Integer> getter);

    List<Novel> getPersonalComics(String username);

    IPage<Novel> searchByName(Integer current, Integer pageSize, String novelName);

    Integer updateCollectNum(String novelId, Integer value);

    Integer updateCommentNum(String novelId, Integer value);

    Integer updateState(String novelId, StateEnum state);

    IPage<Novel> getByState(Integer current, Integer pageSize, StateEnum state);
}
